{/* LAYOUT模板 */}
	<layout name="layout"/>
{/* LAYOUT模板 */}

{/* import Js,Css */}
	<js href="__PUBLIC__/Js/admin/listTable.js"/>
	<js href="__PUBLIC__/Js/admin/js.util.js"/>
	<css href="__PUBLIC__/Css/admin/common.css"/>
	<js href="__PUBLIC__/Js/admin/js.selectzone.js"/>
	
	<css href="__PUBLIC__/Css/jquery-ui.css" />
	<js href="__PUBLIC__/Js/core/jquery-ui.1.10.4.js" />
	<js href="__PUBLIC__/Js/core/plugins.js"/>
{/* import Js,Css */}

<!-- [position] -->
	<include file="Template:position"/>
<!-- [position] -->

<div class="main-div">
	<table cellspacing="1" cellpadding="3" width="100%">
		<tbody>
			<tr>
				<td class="label">
					<a href="javascript:showNotice('noticeOrderSn');" title="点击此处查看提示信息">
					<img src="__PUBLIC__/Image/Admin/notice.gif" width="16" height="16" border="0" alt="点击此处查看提示信息"></a>主订单：
				</td>
				<td>
					<input name="to_order_sn" type="text" id="to_order_sn">
					<select name="to_list" id="to_list" onchange="if (this.value != '') document.getElementById('to_order_sn').value = this.value;">
						<option value="">请选择...</option>
						<volist name="order_list" id="order">
							<option value="{$order.order_sn}">{$order.order_sn} [{$order.user_name}]</option>
						</volist>
					</select>
					<span class="notice-span" style="display:block" id="noticeOrderSn">当两个订单不一致时，合并后的订单信息（如：支付方式、配送方式、包装、贺卡、红包等）以主订单为准。</span>
				</td>
			</tr>
			<tr>
				<td class="label">从订单：</td>
				<td>
					<input name="from_order_sn" type="text" id="from_order_sn">
					<select name="from_list" onchange="if (this.value != '') document.getElementById('from_order_sn').value = this.value;">
						<option value="">请选择...</option>
						<volist name="order_list" id="order">
							<option value="{$order.order_sn}">{$order.order_sn} [{$order.user_name}]</option>
						</volist>
					</select>
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<div align="center">
						<input name="merge" type="button" id="merge" value="合并" onclick="{if(confirm('确认删除')) merge()}">
					</div>
				</td>
			</tr>
		</tbody>
	</table>
</div>
<script>	
    /**
     * 合并
     */
    function merge(){
        var fromOrderSn 	= 	document.getElementById('from_order_sn').value;
        var toOrderSn 		= 	document.getElementById('to_order_sn').value;
        //Ajax.call('order.php?is_ajax=1&act=ajax_merge_order','from_order_sn=o' + fromOrderSn + '&to_order_sn=o' + toOrderSn, mergeResponse, 'POST', 'JSON');
		$.ajax({
			url:'__URL__/ajax_merge_order',
			datatype:'json',
			type:'post',
			data:{'from_order_sn':'o' + fromOrderSn,'to_order_sn':'o' + toOrderSn},
			beforeSend:function(){
			
			},
			success:function(msg){
				
			}
		});
    }
    function mergeResponse(result){
		if (result.message.length > 0){
			alert(result.message);
		}
		if (result.error == 0){
			//成功则清除用户填写信息
			document.getElementById('from_order_sn').value = '';
			document.getElementById('to_order_sn').value = '';
			location.reload();
		}
    }
    onload = function(){
        // 开始检查订单
        //startCheckOrder();
    }
</script>





